home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / dist / config.gcc < prev    next >
Encoding:
Text File  |  1990-02-04  |  7.9 KB  |  354 lines

  1. #!/bin/sh
  2. # Configuration script for GNU CC
  3. #   Copyright (C) 1988 Free Software Foundation, Inc.
  4.  
  5. #This file is part of GNU CC.
  6.  
  7. #GNU CC is free software; you can redistribute it and/or modify
  8. #it under the terms of the GNU General Public License as published by
  9. #the Free Software Foundation; either version 1, or (at your option)
  10. #any later version.
  11.  
  12. #GNU CC is distributed in the hope that it will be useful,
  13. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. #GNU General Public License for more details.
  16.  
  17. #You should have received a copy of the GNU General Public License
  18. #along with GNU CC; see the file COPYING.  If not, write to
  19. #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. #
  22. # Shell script to create proper links to machine-dependent files in
  23. # preparation for compiling gcc.
  24. #
  25. # Usage: config.gcc [vint] machine
  26. #
  27. # If config.gcc succeeds, it leaves its status in config.status.
  28. # If config.gcc fails after disturbing the status quo, 
  29. #     config.status is removed.
  30. #
  31.  
  32. progname=$0
  33.  
  34. remove=rm
  35. hard_link=ln
  36. symbolic_link='ln -s'
  37.  
  38. #for Test
  39. #remove="echo rm"
  40. #hard_link="echo ln"
  41. #symbolic_link="echo ln -s"
  42.  
  43. for arg in $*;
  44. do
  45.   case $arg in
  46.    -srcdir=*)
  47.     srcdir=`echo $arg | sed s/-srcdir=//`
  48.     ;;
  49.    -vint)
  50.     vint=on
  51.     ;;
  52.    *)
  53.     machine=$arg
  54.     ;;
  55.   esac
  56. done
  57.  
  58. # Find the source files, if location was not specified.
  59. if [ x$srcdir = x ]
  60. then
  61.     srcdirdefaulted=1
  62.     srcdir=.
  63.     if [ ! -r tree.c ]
  64.     then
  65.         srcdir=..
  66.     fi
  67. fi
  68.  
  69. if [ ! -r ${srcdir}/tree.c ]
  70. then
  71.     if [ x$srcdirdefaulted = x ]
  72.     then
  73.       echo "$progname: Can't find compiler sources in \`${srcdir}'." 1>&2
  74.     else
  75.       echo "$progname: Can't find compiler sources in \`.' or \`..'." 1>&2
  76.     fi
  77.     exit 1
  78. fi
  79.  
  80. if [ x$machine != x ];
  81. then
  82.     case $machine in
  83.     vax)                    # for vaxen running bsd
  84.         ;;
  85.         tahoe)                                  # for tahoe's running bsd
  86.                 ;;
  87.         harris)                                 # for harris tahoe, using COFF.
  88.         cpu_type=tahoe
  89.                 ;;
  90.     vms)                    # for vaxen running VMS
  91.         cpu_type=vax
  92.         configuration_file=xm-${machine}.h
  93.         target_machine=tm-${machine}.h
  94.         ;;
  95.     vax-sysv | vaxv)            # for vaxen running system V
  96.         cpu_type=vax
  97.         configuration_file=xm-vaxv.h
  98.         target_machine=tm-vaxv.h
  99.         ;;
  100.     sequent-i386)            # for Intel 80386's on Sequent Symmetry
  101.         cpu_type=i386
  102.         configuration_file=xm-i386.h
  103.         target_machine=tm-seq386.h
  104.         ;;
  105.     i386-mach)
  106.         cpu_type=i386
  107.         configuration_file=xm-i386.h
  108.         target_machine=tm-i386gas.h
  109.         ;;
  110.     i386-sysv | i386v)        # for Intel 80386's running system V
  111.         machine=i386v
  112.         cpu_type=i386
  113.         configuration_file=xm-${machine}.h
  114.         ;;
  115.     i386-sysv-gas | i386g)
  116.         cpu_type=i386
  117.         configuration_file=xm-i386v.h
  118.         target_machine=tm-i386gas.h
  119.         ;;        
  120.     i386-aix | ps2-aix | aix386 | ps2aix )        # for IBM PS/2 running AIX
  121.         machine=aix386
  122.         cpu_type=i386
  123.         configuration_file=xm-${machine}.h
  124.         ;;
  125.     i860)
  126.         ;;
  127.     next )
  128.         cpu_type=m68k
  129.         target_machine=tm-next.h
  130.         ;;
  131.     sun4 | sun-4 | sun4-os3 | sun-4-os3)
  132.         cpu_type=sparc
  133.         target_machine=tm-sun4os3.h
  134.         ;;
  135.     sun3 | sun-3 | sun3-os3 | sun-3-os3)
  136.         cpu_type=m68k
  137.         target_machine=tm-sun3os3.h
  138.         ;;
  139.     sun3-nfp | sun-3-nfp | sun3-nfp-os3 | sun-3-nfp-os3)
  140.         cpu_type=m68k
  141.         target_machine=tm-sun3os3nf.h
  142.         ;;
  143.     sun2 | sun-2 | sun2-os3 | sun-2-os3)
  144.         cpu_type=m68k
  145.         target_machine=tm-sun2.h
  146.         ;;
  147.     sun386 | sun386i | roadrunner)
  148.         cpu_type=i386
  149.         configuration_file=xm-sun386i.h
  150.         target_machine=tm-sun386i.h
  151.         ;;
  152.     sun4-os4 | sun-4-os4)
  153.         cpu_type=sparc
  154.         target_machine=tm-sparc.h
  155.         ;;
  156.     sun3-os4 | sun-3-os4)
  157.         cpu_type=m68k
  158.         target_machine=tm-sun3.h
  159.         ;;
  160.     sun3-nfp-os4 | sun-3-nfp-os4)
  161.         cpu_type=m68k
  162.         target_machine=tm-sun3-nfp.h
  163.         ;;
  164.     sun2-os4 |sun-2-os4)
  165.         cpu_type=m68k
  166.         target_machine=tm-sun2.h
  167.         ;;
  168.     hp9k320)            # HP 9000 series 300 with gcc alone
  169.         cpu_type=m68k
  170.         configuration_file=xm-hp9k320.h
  171.         ;;
  172.     hp9k320-old)            # HP 9000 series 300 with gcc alone
  173.         cpu_type=m68k
  174.         target_machine=tm-hp9k32old.h
  175.         configuration_file=xm-hp9k320.h
  176.         ;;
  177.     hp9k320-gas | hp9k320g)        #    with gnu as, ld and gdb
  178.         cpu_type=m68k
  179.         configuration_file=xm-hp9k320.h
  180.         target_machine=tm-hp9k320g.h
  181.         ;;
  182.     hp9k320-bsd)            # HP 9000/3xx running Berkeley Unix
  183.         cpu_type=m68k
  184.         target_machine=tm-hp9k3bsd.h
  185.         ;;
  186.     isi68)
  187.         cpu_type=m68k
  188.         ;;
  189.     isi68-nfp)
  190.         cpu_type=m68k
  191.         ;;
  192.     news | news800)
  193.             configuration_file=xm-m68k.h
  194.             target_machine=tm-news.h
  195.         cpu_type=m68k
  196.         ;;
  197.     news-gas | news-g)
  198.             configuration_file=xm-m68k.h
  199.             target_machine=tm-newsgas.h
  200.         cpu_type=m68k
  201.         ;;
  202.     altos | altos3068)        # Altos 3068 with gnu as, ld and gdb
  203.             cpu_type=m68k
  204.             configuration_file=xm-altos3068.h
  205.             target_machine=tm-altos3068.h
  206.             ;;
  207.     3b1)
  208.         cpu_type=m68k
  209.         configuration_file=xm-${machine}.h
  210.         ;;
  211.     3b1g | 3b1-gas)
  212.         machine=3b1g
  213.         cpu_type=m68k
  214.         configuration_file=xm-3b1.h
  215.         ;;
  216.     sequent-ns32k | sequent)
  217.         machine=sequent
  218.         cpu_type=ns32k
  219.         ;;
  220.     encore)
  221.         cpu_type=ns32k
  222.         ;;
  223.     genix)
  224.         machine=ns32k
  225.         cpu_type=ns32k
  226.         configuration_file=xm-genix.h
  227.         ;;
  228.     88000)
  229.         cpu_type=m88k
  230.         target_machine=tm-${cpu_type}.h
  231.         ;;
  232.     alliant)                # Alliant FX/8
  233.         ;;
  234.     convex-c1)                # Convex C1
  235.         target_machine=tm-convex1.h
  236.         cpu_type=convex
  237.         ;;
  238.     convex-c2)                # Convex C2
  239.         target_machine=tm-convex2.h
  240.         cpu_type=convex
  241.         ;;
  242.     iris)                    # Mostly like a MIPS.
  243.         cpu_type=mips
  244.         target_machine=tm-iris.h
  245.         configuration_file=xm-iris.h
  246.         ;;
  247.     mips)                # Default MIPS environment
  248.         ;;
  249.     mips-sysv)            # SYSV variant of MIPS system.
  250.         cpu_type=mips
  251.         target_machine=tm-mips-sysv.h
  252.             ;;
  253.     mips-bsd43)            # BSD 4.3 variant of MIPS system.
  254.         cpu_type=mips
  255.         target_machine=tm-mips-bsd.h
  256.             ;;
  257.     dec-3100 | decstation)        # Decstation or pmax.
  258.         cpu_type=mips
  259.         target_machine=tm-decstatn.h
  260.             ;;
  261.     apollo68)
  262.         cpu_type=m68k
  263.         ;;
  264.     pyr | pyramid)
  265.         machine=pyr
  266.         ;;
  267. #    370)
  268. #        machine=370
  269. #        ;;
  270.     esac
  271.  
  272.         # if cpu_type is not set, define cpu_type to machine.
  273.         #
  274.     cpu_type=${cpu_type-$machine}
  275.     configuration_file=${configuration_file-xm-$cpu_type.h}
  276.     target_machine=${target_machine-tm-$machine.h}
  277.     machine_description=${cpu_type}.md
  278.     aux_output=${aux_output-out-$cpu_type.c}
  279.  
  280.     if [ xx${vint} = xx ]
  281.     then
  282.         files="$configuration_file $target_machine
  283.             $machine_description $aux_output"
  284.         links="config.h tm.h md aux-output.c"
  285.     else
  286.         files="$configuration_file tm-vmc.h $target_machine
  287.             $machine_description $aux_output"
  288.         links="config.h tm.h tm-pre.h md aux-output.c"
  289.     fi
  290.  
  291.     while [ -n "$files" ]
  292.     do
  293.         # set file to car of files, files to cdr of files
  294.         set $files; file=$1; shift; files=$*
  295.         set $links; link=$1; shift; links=$*
  296.  
  297.         if [ ! -r ${srcdir}/config/$file ]
  298.         then
  299.             echo "$progname: cannot create a link \`$link'," 1>&2
  300.             echo "since the file \`config/$file' does not exist." 1>&2
  301.             exit 1
  302.         fi
  303.  
  304.         $remove -f $link
  305.         rm -f config.status
  306.         # Make a symlink if possible, otherwise try a hard link
  307.         $symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link
  308.  
  309.         if [ ! -r $link ]
  310.         then
  311.             echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2
  312.             exit 1
  313.         fi
  314.         echo "Linked \`$link' to \`${srcdir}/config/$file'."
  315.     done
  316.  
  317.     if [ xx${vint} = xx ]
  318.     then
  319.         echo "Links are now set up for use with a $machine." \
  320.             | tee config.status
  321.     else
  322.         echo "Links are now set up for use with a $machine (vint)." \
  323.             | tee config.status
  324.     fi
  325.  
  326.     # Install a makefile, and make it set VPATH
  327.     # if necessary so that the sources are found.
  328.     # Also change its value of srcdir.
  329.     # Also create a .gdbinit file which runs the one in srcdir
  330.     # and tells GDB to look there for source files.
  331.     case $srcdir in
  332.     .)
  333.         ;;
  334.     *)
  335.         echo "VPATH = ${srcdir}" > x
  336.         cat x ${srcdir}/Makefile | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile
  337.         rm x
  338.         echo "dir ${srcdir}" > .gdbinit
  339.         echo "source ${srcdir}/.gdbinit" >> .gdbinit
  340.         ;;
  341.     esac
  342.  
  343.     exit 0
  344. else
  345.     echo "Usage: $progname machine"
  346.     echo -n "Where \`machine' is something like "
  347.     echo "\`vax', \`sun3', \`umax', etc."
  348.     if [ -r config.status ]
  349.     then
  350.         cat config.status
  351.     fi
  352.     exit 1
  353. fi
  354.